<?php

namespace app\common\model;

use think\Model;

class Msg extends Model
{

    static function send($cmd){
        $device_id = $cmd->device_id;
        $msgs = $cmd->cmd;
        $msg_array = explode("+",$msgs);
        if(is_array($msg_array)){
            foreach($msg_array as $msg){
                self::create([
                    "device_id"=>$device_id,
                    "push_msg"=>$msg,
                ]);
            };
        }else{
            self::create([
                "device_id"=>$device_id,
                "push_msg"=>$msgs,
            ]);
        }
    }
}
